//
//  ZKJAction.m
//  PolicyDetail
//
//  Created by 我叫MT on 16/7/30.
//  Copyright © 2016年 Pinksnow. All rights reserved.
//

#import "base_Tooltip.h"
#import "UILabel+base_AlertActionFont.h"
@implementation base_Tooltip



+(UIAlertController *)alterWithTitleArray:(NSArray *)array withBlock:(clickBlock)block
{
    
    return    [self alterWithTitle:array[0] withDescribe:array[1] withActionTitle:array[2] withBlock:block];
}



+(UIAlertController *)ActionSheetWithTitleArray:(NSArray *)array withBlock:(clickBlock)block  withCancelBlock:(cancelBlock)cancelBlock
{
    return    [self ActionSheetWithTitle:array[0] withDescribe:array[1] withActionTitle:array[2] withBlock:block  withCancelBlock:cancelBlock];
}


+(UIAlertController *)alterWithTwoActionByArray:(NSArray *)array withblock:(clickBlock)block
                                withSecondBlock:(cancelBlock)cancelBlock
{
    return   [self ActionSheetWithTwoActionTitle:array[0] withDescribe:array[1] withcancelActionTitle:array[2] withOKActionTitle:array[3] withBlock:block withCancelBlock:cancelBlock];
}





+(void)SVProgressWithTitle:(NSString *)Str
{
    // [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
    //    [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    //    [SVProgressHUD setBackgroundLayerColor:[[UIColor whiteColor] colorWithAlphaComponent:0.4]];
    [SVProgressHUD showSuccessWithStatus:@"什么啊"];
}




+(void)noticesWithTitle:(NSString *)title Time:(NSTimeInterval )time fatherView:(UIView *)view style:(YHNoticesStyle)style
{
    [base_PopView noticesWithTitle:title Time:time View:view style:style];
}

+(void)SVProgressShowFailMessage:(NSString *)string{
    [SVProgressHUD showErrorWithStatus:string];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [SVProgressHUD dismiss];
    });
}

+(void)SVProgressShowSuccessMessage:(NSString *)string{
    [SVProgressHUD showSuccessWithStatus:string];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)( 1* NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [SVProgressHUD dismiss];
    });
}

-(void)clickBlock:(clickBlock)block
{
    if (!_block) {
        _block = block;
    }
}

-(void)cancelBlock:(cancelBlock)block
{
    if (!_cancelBlock) {
        _cancelBlock = block;
    }
}


+(UIAlertController *)alterWithTitle:(NSString *)title
                        withDescribe:(NSString *)describe
                     withActionTitle:(NSString *)actiontitle
                           withBlock:(clickBlock)block
{
    
    UIAlertController *alterC = [UIAlertController alertControllerWithTitle:title message:describe preferredStyle:UIAlertControllerStyleAlert];
    [alterC addAction:[UIAlertAction actionWithTitle:actiontitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        if (block) {
            block();
        }
    }]];
    return alterC;
}



+(UIAlertController *)ActionSheetWithTitle:(NSString *)title
                              withDescribe:(NSString *)describe
                           withActionTitle:(NSString *)actiontitle
                                 withBlock:(clickBlock)block
                                 withCancelBlock:(cancelBlock)cancelBlock
{
    UIAlertController *alterC = [UIAlertController alertControllerWithTitle:title message:describe preferredStyle:UIAlertControllerStyleActionSheet];
    [alterC addAction:[UIAlertAction actionWithTitle:actiontitle style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
        if (block) {
            block();
        }
    }]];
    [alterC addAction:[UIAlertAction actionWithTitle:actiontitle style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        if (cancelBlock) {
            cancelBlock();
        }
    }]];
    return alterC;
}

+(UIAlertController *)ActionSheetWithTwoActionTitle:(NSString *)title
                                       withDescribe:(NSString *)describe
                              withcancelActionTitle:(NSString *)cancelTitle
                                  withOKActionTitle:(NSString *)confirmTitle
                                          withBlock:(clickBlock)block
                                    withCancelBlock:(cancelBlock)cancelBlock
{
    UIAlertController *alterC = [UIAlertController alertControllerWithTitle:title message:describe preferredStyle:UIAlertControllerStyleAlert];
    //字号处理
    //    UILabel *appearanceLabel = [UILabel appearanceWhenContainedIn:UIAlertController.class, nil];
    //    UIFont *font = [UIFont systemFontOfSize:15];
    //    [appearanceLabel setAppearanceFont:font];
    [alterC addAction:[UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        if (cancelBlock) {
            cancelBlock();
        }
        
    }]];
    [alterC addAction:[UIAlertAction actionWithTitle:confirmTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        if (block) {
            block();
        }
        
    }]];
    
    
    return alterC;
}

@end
